package cn.com.sinux.spring.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/9/6.
 */
public class ParseHelper {

    public static interface ParseWorker<T, E> {
        public T parse(E t);
    }

    public static <T, E> List<T> parse(List<E> eList, ParseWorker<T, E> parseWorker) {
        List<T> ts = new ArrayList<T>();
        for (E e : eList) {
            ts.add(parseWorker.parse(e));
        }
        return ts;
    }

    public static <T, E> List<T> parse(E[] eList, ParseWorker<T, E> parseWorker) {
        List<T> ts = new ArrayList<T>();
        for (E e : eList) {
            ts.add(parseWorker.parse(e));
        }
        return ts;
    }
}
